package com.qingke.hibernate.bean;

import java.sql.Time;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name="course_set")
//@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class CourseSet {
	@Id
	@Column(name="id")
	private int id;
	
	@Column(name="capacity")
	private int capacity;
	
	@Column(name="margin")
	private int margin;
	
	@Column(name="class_time")
	private Time classTime;
	
	@ManyToOne/*(fetch=FetchType.EAGER)*/
	@JoinColumn(name="teacher_id")
	private Teacher teacher;
	
	@OneToMany(mappedBy="courseSet")
	private Set<CourseModel> courseModels;
	
	@OneToMany(mappedBy="courseSet")
	private Set<SelectCourse> selectCourses;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getCapacity() {
		return capacity;
	}

	public void setCapacity(int capacity) {
		this.capacity = capacity;
	}

	public int getMargin() {
		return margin;
	}

	public void setMargin(int margin) {
		this.margin = margin;
	}

	public Time getClassTime() {
		return classTime;
	}

	public void setClassTime(Time classTime) {
		this.classTime = classTime;
	}

	public Teacher getTeacher() {
		return teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	public Set<CourseModel> getCourseModels() {
		return courseModels;
	}

	public void setCourseModels(Set<CourseModel> courseModels) {
		this.courseModels = courseModels;
	}

	public Set<SelectCourse> getSelectCourses() {
		return selectCourses;
	}

	public void setSelectCourses(Set<SelectCourse> selectCourses) {
		this.selectCourses = selectCourses;
	}

	@Override
	public String toString() {
		return "CourseSet [id=" + id + ", capacity=" + capacity + ", margin=" + margin + ", classTime=" + classTime
				+ ", teacher=" + teacher + "]";
	}
	
	
	
}
